import json


class FileUtil(object):

    def write(self, fileName, value):
        with open(fileName, 'w', encoding='utf-8') as f:
            if 'json' in fileName:
                json.dump(value, f)
            else:
                f.write(value)
            f.close()

    def read(self, fileName):
        with open(fileName, 'r', encoding="utf-8") as f:
            if 'json' in fileName:

                return json.load(f)
            else:
                return f.read()
